﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BaoBiaoDY.aspx.cs" Inherits="Web.Pages.YongShui.BaoBiaoGL.BaoBiaoDY" Theme="Default" %>
<%--已废弃 comment by guodengjie at 2017/6/13--%>


<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxTreeList.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxTreeList" TagPrefix="dx" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>报表打印</title>
    <script src="../../../JS/AddEditCancel.js" type="text/javascript"></script>
    <script type="text/javascript">
        function openNew() {
            var controlnames = hdCS.Get("controlnames").split(",");
            var canshulxs = hdCS.Get("canshulxs").split(",");
            var paramsArr = new Array();
            var clientObject;
            var val;
            for (var i = 0; i < controlnames.length; i++) {
                if (canshulxs[i] == "txt") {
                    clientObject = ASPxClientTextBox.Cast(controlnames[i]);
                    val = clientObject.GetText();
                } else if (canshulxs[i] == "cmb") {
                    clientObject = ASPxClientComboBox.Cast(controlnames[i]);
                    val = clientObject.GetValue();
                }
                paramsArr[i] = controlnames[i] + ":" + val;
            }
            var paramsStr = "";
            var paramsStr = paramsArr.join("|");
            var url = "BaoBiaoView.aspx?baobiaoid=" +
                hdCS.Get("baobiaoid") +
                "&x=" +
                txtX.GetText() +
                "&y=" +
                txtY.GetText() +
                "&baobiaocs=" +
                paramsStr;
            openCenter(url, "1000", "1000");
            //alert(paramsStr); 
            //layer.open({
            //    type: 2,
            //    title: '报表预览打印',
            //    shadeClose: false,
            //    shade: 0.8,
            //    area: ['1000px', '1000px'],
            //    content: url
            //});
        }

        function open1() {

        }

        function SaveOptions() {
            if (txtX.GetText() == "") {
                alert("请输入横向偏移量");
                return;
            }
            if (!isAllNum(txtX.GetText())) {
                alert("请输入正确的横向偏移量");
                return;
            }
            if (txtY.GetText() == "") {
                alert("请输入纵向偏移量");
                return;
            }
            if (!isAllNum(txtY.GetText())) {
                alert("请输入正确的纵向偏移量");
                return;
            }
            ASPxCallback1.PerformCallback("SaveOptions");
        }

        function ASPxCallback1Complete(rs) {
            var arr = rs.split('|');
            var type = arr[0];
            var state = arr[1];
            var specialIdentity = arr[2];
            var msg = arr[3].split('-');
            if (msg[0] == 'True') {
                alert(msg[1]);
            }
            hdCollection.Set("type", type);
            if (state == 'True') {
                if (type == "SaveOptions") {

                }
            } else {

            }
        }
    </script>
</head>

<body>

<form id="form1" runat="server">

    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div class="tabletitle1" align="center">
        报表打印
    </div>
    <dx:ASPxHiddenField ID="hdCollection" ClientInstanceName="hdCollection" runat="server"></dx:ASPxHiddenField>
    <dx:ASPxCallback ID="ASPxCallback1" ClientInstanceName="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback" ClientSideEvents-CallbackComplete="function(s,e){ASPxCallback1Complete(e.result);}"></dx:ASPxCallback>
    <div>
        <asp:UpdatePanel runat="server" ID="UpdatePanel2">
            <ContentTemplate>
                <dx:ASPxHiddenField ID="hdCS" ClientInstanceName="hdCS" runat="server"></dx:ASPxHiddenField>
                <div style="float: left; width: 40%">

                    <dx:ASPxTreeList ID="tree1" runat="server" Width="100%" KeyFieldName="I_BAOBIAOID" ParentFieldName="I_FUID"
                                     SettingsPager-AlwaysShowPager="true" AutoGenerateColumns="false"
                                     EnableCallbacks="false">
                        <Columns>
                            <dx:TreeListDataColumn FieldName="I_BAOBIAOID" Visible="false"></dx:TreeListDataColumn>
                            <dx:TreeListTextColumn FieldName="S_BAOBIAOMC" Caption="名称"></dx:TreeListTextColumn>
                        </Columns>
                        <Settings ShowColumnHeaders="false"/>
                        <SettingsBehavior AutoExpandAllNodes="true" AllowFocusedNode="true" ProcessFocusedNodeChangedOnServer="false" ExpandCollapseAction="NodeDblClick"/>
                        <SettingsText LoadingPanelText="正在加载请稍候......"/>
                        <Settings VerticalScrollBarMode="Auto" ScrollableHeight="530"/>
                        <ClientSideEvents FocusedNodeChanged="function(s,e){btnLoadPara.onClick();}" NodeCollapsing="function(s,e){btnOK.SetVisible(false);}"/>
                    </dx:ASPxTreeList>

                </div>
                <div style="float: left; width: 2%">
                    &nbsp;
                </div>
                <div style="float: left; width: 58%">

                    <dx:ASPxButton ID="btnLoadPara" ClientInstanceName="btnLoadPara" runat="server" Text="加载参数列表" ClientVisible="false" OnClick="btnLoadPara_Click">
                    </dx:ASPxButton>
                    <asp:Table ID="tabCS" runat="server">
                    </asp:Table>
                    <hr/>
                    <table id="tabPZ" runat="server">
                        <tr style="display: none">
                            <td style="text-align: right">偏移量X：</td>
                            <td>
                                <dx:ASPxTextBox ID="txtX" ClientInstanceName="txtX" runat="server" Width="100%"></dx:ASPxTextBox>
                            </td>
                            <td style="text-align: right">偏移量Y：</td>
                            <td>
                                <dx:ASPxTextBox ID="txtY" ClientInstanceName="txtY" runat="server" Width="100%"></dx:ASPxTextBox>
                            </td>
                        </tr>
                        <tr style="display: none">
                            <td style="text-align: right">打印份数：</td>
                            <td>
                                <dx:ASPxTextBox ID="txtCopies" ClientInstanceName="txtCopies" runat="server" Width="100%"></dx:ASPxTextBox>
                            </td>
                            <td style="text-align: right"></td>
                            <td>
                            </td>
                        </tr>
                        <tr style="display: none">
                            <td style="text-align: right">打印机：</td>
                            <td colspan="3">
                                <dx:ASPxTextBox ID="txtPrintName" ClientInstanceName="txtPrintName" runat="server" Width="100%"></dx:ASPxTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4" style="text-align: center">
                                <span style="margin: auto">
                                    <dx:ASPxButton ID="btnPreview" ClientInstanceName="btnPreview" runat="server" Text="预览" AutoPostBack="false">
                                        <ClientSideEvents Click="function(s,e){openNew();}"/>
                                    </dx:ASPxButton>
                                </span>
                                <span>
                                    <dx:ASPxButton ID="btnShowOptions" ClientInstanceName="btnSaveOptions" runat="server" Text="展开配置" ClientVisible="false" AutoPostBack="false">
                                        <ClientSideEvents Click="function(s,e){ShowOptions();}"/>
                                    </dx:ASPxButton>
                                    <dx:ASPxButton ID="btnSaveOptions" ClientInstanceName="btnSaveOptions" runat="server" Text="保存配置" ClientVisible="false" AutoPostBack="false">
                                        <ClientSideEvents Click="function(s,e){SaveOptions();}"/>
                                    </dx:ASPxButton>

                                </span>
                                <%--<table width="100%">
                                <tr>
                                    <td style="text-align:center">
                                        
                                    </td>
                                    <td style="text-align:center;display:none">
                                        
                                    </td>
                                </tr>
                            </table>--%>
                            </td>
                        </tr>
                    </table>

                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</form>

</body>

</html>